package com.ruoyi.back.controller

import com.ruoyi.app.common.Data
import com.ruoyi.app.common.PageData
import com.ruoyi.back.domain.dto.CheckTemplateDto
import com.ruoyi.back.domain.dto.TemplateCommentSearchDto
import com.ruoyi.back.domain.vo.CheckStatusSumVo
import com.ruoyi.back.domain.vo.TemplateCommentListVo
import com.ruoyi.back.domain.vo.TemplateCommentVo
import com.ruoyi.back.service.TemplateCommentService
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@RestController
@RequestMapping("system/templateComment")
@Api(tags = ["模板评论"])
class TemplateCommentController {

    @Autowired
    private lateinit var templateCommentService: TemplateCommentService


    @ApiOperation("获取审核状态统计")
    @GetMapping("checkStatusSum")
    fun checkStatusSum(): Data<CheckStatusSumVo> = templateCommentService.checkStatusSum()

    @ApiOperation("获取模板评论列表")
    @GetMapping("page")
    fun templateCommentPage(templateCommentSearchDto: TemplateCommentSearchDto): PageData<TemplateCommentListVo> =
        templateCommentService.templateCommentPage(templateCommentSearchDto)

    @ApiOperation("审核模板评论")
    @PostMapping("checkTemplateComment")
    fun checkTemplateComment(@RequestBody checkTemplateDto: CheckTemplateDto): Data<Boolean> =
        templateCommentService.checkTemplateComment(checkTemplateDto)

    @ApiOperation("移除模板评论")
    @GetMapping("remove/{ids}")
    fun removeTemplateComment(@PathVariable ids: String): Data<Boolean> =
        templateCommentService.removeTemplateComment(ids)

    @ApiOperation("获取模板的评论分页列表")
    @GetMapping("getTemplateCommentPage/{id}")
    fun getTemplateCommentPage(@PathVariable id: Long): PageData<TemplateCommentVo> =
        templateCommentService.getTemplateCommentPage(id)
}